package com.rongmei.jdsync.client;

import com.rongmei.jdsync.dto.RBase;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;

/**
 * @author dongjun
 */
@FeignClient(
        name = "market-center-goods-core",
        contextId = "mallGoodsFeignApi"
)
public interface MallGoodsFeignApi {

    /**
     * 下架商品接口
     * 该接口用于将指定商品进行下架操作，通过商品ID和状态进行下架处理
     *
     * @param goodsIds 商品ID字符串，多个ID用逗号分隔  例:10,11,12
     * @param status   商品状态，用于指定下架的状态值   2:上架 3:下架
     * @return RBase   返回操作结果对象
     */
    @PostMapping(value = "/mcgoods/server/jd/mall/goods/goodsPutOff", produces = "application/json")
    RBase goodsPutOff(
            @RequestParam("goodsIds") String goodsIds,
            @RequestParam("status") Integer status
    );


    /**
     * 获取同步商品分页数据
     * 北海海融媒APP提供此接口
     *
     * @param page 页码，表示当前请求的是第几页数据
     * @param size 页面大小，表示每页包含多少条数据
     * @return 返回RBase<Long>类型的对象，List<Long> list
     */
    @GetMapping(value = "/mcgoods/server/jd/mall/goods/getSyncGoodsPage", produces = "application/json")
    RBase<Long> getSyncGoodsPage(@RequestParam("page") Integer page,
                                 @RequestParam("size") Integer size);

    /**
     * 更新商品价格
     * 北海海融媒APP提供此接口，单个商品价格更新
     *
     * @param goodsId     商品外部编号
     * @param originPrice 原价
     * @param actualPrice 售价
     * @return RBase {"status":200,"msg":"操作成功","timeStamp":1748487282729}
     */
    @PostMapping(value = "/mcgoods/server/jd/mall/goods/goodsUpdatePrice", produces = "application/json")
    RBase goodsUpdatePrice(@RequestParam("goodsId") String goodsId,
                           @RequestParam("originPrice") BigDecimal originPrice,
                           @RequestParam("actualPrice") BigDecimal actualPrice);
}